package properties

import grails.test.*

class PETTests extends GrailsUnitTestCase {
    
	private String course = "Computação"
	private String institute = "Universidade Federal de Campina Grande"
	private String acronym = "UFCG"
	private double cre = 7.1
	
	protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testValues() {
    	def p = new PET(course:course, institute:institute, acronym:acronym, cre:cre)
    	assertEquals course, p.course
    	assertEquals institute, p.institute
    	assertEquals acronym, p.acronym
    	assertEquals cre, p.cre
    }
    
    void testConstraints() {
    	def p = new PET();
    	mockForConstraintsTests(PET,[p])
    	
    	assertFalse p.validate() 
		assertEquals "nullable", p.errors["course"] 
		assertEquals "nullable", p.errors["institute"]
		assertEquals "nullable", p.errors["acronym"]
    }
}